package com.yss.sofa.report.engine.cell.page;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;

import com.yss.sofa.report.engine.cell.FloatingCell;
import com.yss.sofa.report.engine.cell.ReportCell;
import com.yss.sofa.report.engine.cell.page.header.ColCell;
import com.yss.sofa.report.engine.cell.page.header.RowCell;

public class PageCell extends ReportCell{
	private static final long serialVersionUID = -7745377313426877400L;
	private int colCount;//列数，计算
	private int rowCount;//行数，计算
	private String title;//表头行数，配置
	private int titleCount;//表头行数，计算
	private String header;//列头行数，配置
	private int headerCount;//列头行数，计算
	private String footer;//列脚行数，配置
	private int footerCount;//列脚行数，计算
	private String page;//页数，配置
	private int pageCount;//页数，计算
	private String total;//总记录数，配置
	private int pageTotal;//总记录数，计算	
	private String renderer;//渲染器，配置
	private String name;//sheet名称，配置
	private boolean includePHF;//包含页眉页脚，配置
	private String javascript;//js代码坐标，配置
	private boolean dynamicVisible;//动态可见性，配置
	private boolean dynamicMerge;//动态（强制）合并，配置
	private boolean dynamicStyle;//动态样式，配置
	private boolean dynamicHTML;//动态HTML，配置
	private boolean dynamicAttr;//动态属性，配置
	private boolean dynamicSize;//动态列宽，配置
	private boolean dynamicZoom;//动态缩放到一页纸，临时，配置
	private boolean includeFormula;//是否包括公式，默认包含
	private boolean protectSheet;  //是否保护工作表
	private String protectPass;  //保护工作表密码
	private Map<String,String> attr=new HashMap<String, String>();
	private LinkedHashSet<String> floatings=new LinkedHashSet<String>();//浮动单元格坐标，配置
	private LinkedHashSet<FloatingCell> floatingCells=new LinkedHashSet<FloatingCell>();//浮动单元格，计算
	private List<RowCell> rows=new ArrayList<RowCell>();//行头，计算
	private List<ColCell> cols=new ArrayList<ColCell>();//列头，计算
	private float fontWidth;//默认字体宽度，计算
	private String from;//所属的模板sheet名称，内部
	protected void init() {
		super.init();
		this.title="";
		this.titleCount=0;
		this.header="";
		this.headerCount=0;
		this.footer="";
		this.footerCount=0;
		this.includePHF=false;
		this.dynamicVisible=false;
		this.dynamicMerge=false;
		this.dynamicStyle=false;
		this.dynamicHTML=false;
		this.dynamicAttr=false;
		this.dynamicSize=false;
		this.dynamicZoom=false;
		this.includeFormula=true;
		this.rowCount=0;
		this.colCount=0;
		this.page="";
		this.pageCount=1;
		this.total="";
		this.pageTotal=1;
		this.javascript="";
		this.fontWidth=7.0017f;
		this.renderer="";
		this.name="";
		this.from=null;
		this.protectSheet=false;
		this.protectPass="";
	}
	public void assignTo(ReportCell cell){
		PageCell _=(PageCell)cell;
		super.assignTo(_);
		_.colCount=this.colCount;
		_.rowCount=this.rowCount;
		_.title=this.title;
		_.titleCount=this.titleCount;
		_.header=this.header;
		_.headerCount=this.headerCount;
		_.footer=this.footer;
		_.footerCount=this.footerCount;
		_.includePHF=this.includePHF;
		_.javascript=this.javascript;
		_.dynamicVisible=this.dynamicVisible;
		_.dynamicMerge=this.dynamicMerge;
		_.dynamicStyle=this.dynamicStyle;
		_.dynamicHTML=this.dynamicHTML;
		_.dynamicAttr=this.dynamicAttr;
		_.dynamicZoom=this.dynamicZoom;
		_.dynamicSize=this.dynamicSize;
		_.includeFormula=this.includeFormula;
		_.page=this.page;
		_.pageCount=this.pageCount;
		_.pageTotal=this.pageTotal;
		_.total=this.total;
		_.floatings=this.floatings;
		_.floatingCells.clear();
		_.fontWidth=this.fontWidth;
		_.renderer=this.renderer;
		_.name=this.name;
		_.protectSheet=this.protectSheet;
		_.protectPass=this.protectPass;
		for(FloatingCell f:this.floatingCells){
			FloatingCell newf=new FloatingCell();
			f.assignTo(newf);
			_.floatingCells.add(newf);
		}
		_.rows.clear();
		for(RowCell r:this.rows){
			RowCell newr=new RowCell();
			r.assignTo(newr);
			_.rows.add(newr);
		}
		_.cols.clear();
		for(ColCell c:this.cols){
			ColCell newc=new ColCell();
			c.assignTo(newc);
			_.cols.add(newc);
		}
		_.attr.clear();
		_.attr.putAll(this.attr);
		_.from=this.from;
	}
	public float getFontWidth() {
		return fontWidth;
	}
	public void setFontWidth(float fontWidth) {
		this.fontWidth = fontWidth;
	}
	public PageCell create(){
		PageCell _=new PageCell();
		this.assignTo(_);
		return _;
	}
	public String getTitle() {
		return title;
	}
	public void setTitle(String title) {
		this.title = title;
	}
	public String getHeader() {
		return header;
	}
	public void setHeader(String header) {
		this.header = header;
	}
	public int getPageCount() {
		return pageCount;
	}
	public void setPageCount(int pageCount) {
		this.pageCount = pageCount;
	}
	public boolean isDynamicMerge() {
		return dynamicMerge;
	}
	public void setDynamicMerge(boolean dynamicMerge) {
		this.dynamicMerge = dynamicMerge;
	}
	public boolean isDynamicStyle() {
		return dynamicStyle;
	}
	public void setDynamicStyle(boolean dynamicStyle) {
		this.dynamicStyle = dynamicStyle;
	}
	public LinkedHashSet<String> getFloatings() {
		return floatings;
	}
	public void setFloatings(LinkedHashSet<String> floatings) {
		this.floatings = floatings;
	}
	public LinkedHashSet<FloatingCell> getFloatingCells() {
		return floatingCells;
	}
	public RowCell getRow(int index) {
		return rows.get(index);
	}
	public List<RowCell> getRows() {
		return rows;
	}
	public ColCell getCol(int index) {
		return cols.get(index);
	}
	public List<ColCell> getCols() {
		return cols;
	}
	public int getColCount() {
		return colCount;
	}
	public void setColCount(int colCount) {
		this.colCount = colCount;
	}
	public int getRowCount() {
		return rowCount;
	}
	public void setRowCount(int rowCount) {
		this.rowCount = rowCount;
	}
	public boolean isDynamicVisible() {
		return dynamicVisible;
	}
	public void setDynamicVisible(boolean dynamicVisible) {
		this.dynamicVisible = dynamicVisible;
	}
	public String getPage() {
		return page;
	}
	public void setPage(String page) {
		this.page = page;
	}
	public boolean isDynamicHTML() {
		return dynamicHTML;
	}
	public void setDynamicHTML(boolean dynamicHTML) {
		this.dynamicHTML = dynamicHTML;
	}
	public boolean isDynamicAttr() {
		return dynamicAttr;
	}
	public void setDynamicAttr(boolean dynamicAttr) {
		this.dynamicAttr = dynamicAttr;
	}
	public String getJavascript() {
		return javascript;
	}
	public void setJavascript(String javascript) {
		this.javascript = javascript;
	}
	public int getTitleCount() {
		return titleCount;
	}
	public void setTitleCount(int titleCount) {
		this.titleCount = titleCount;
	}
	public int getHeaderCount() {
		return headerCount;
	}
	public void setHeaderCount(int headerCount) {
		this.headerCount = headerCount;
	}
	public boolean isDynamicZoom() {
		return dynamicZoom;
	}
	public void setDynamicZoom(boolean dynamicZoom) {
		this.dynamicZoom = dynamicZoom;
	}
	public boolean isDynamicSize() {
		return dynamicSize;
	}
	public void setDynamicSize(boolean dynamicSize) {
		this.dynamicSize = dynamicSize;
	}
	public boolean isIncludePHF() {
		return includePHF;
	}
	public void setIncludePHF(boolean includeHF) {
		this.includePHF = includeHF;
	}
	public String getFooter() {
		return footer;
	}
	public void setFooter(String footer) {
		this.footer = footer;
	}
	public int getFooterCount() {
		return footerCount;
	}
	public void setFooterCount(int footerCount) {
		this.footerCount = footerCount;
	}
	public Map<String,String> getAttr() {
		return attr;
	}
	public void setAttr(Map<String,String> attr) {
		this.attr = attr;
	}
	public String getRenderer() {
		return renderer;
	}
	public void setRenderer(String renderer) {
		this.renderer = renderer;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public String getFrom(){
		return this.from;
	}
	public void setFrom(String from){
		this.from=from;
	}
	public boolean isIncludeFormula() {
		return includeFormula;
	}
	public void setincludeFormula(boolean includeFormula) {
		this.includeFormula = includeFormula;
	}
	public boolean isProtectSheet() {
		return protectSheet;
	}
	public void setProtectSheet(boolean protectSheet) {
		this.protectSheet = protectSheet;
	}
	public String getProtectPass() {
		return protectPass;
	}
	public void setProtectPass(String protectPass) {
		this.protectPass = protectPass;
	}
	public String getTotal() {
		return total;
	}
	public void setTotal(String total) {
		this.total = total;
	}
	public int getPageTotal() {
		return pageTotal;
	}
	public void setPageTotal(int pageTotal) {
		this.pageTotal = pageTotal;
	}
}
